• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

App Inventor How to send variable from php to Android Webview?

Hi! thanks in advance for taking the time to help me :)

few days ago I’ve purchased a codecanyon webview framework, made with Kotlin, it is really a great framework since it helped me to turn my website into a real app (I only know how to develope on php & mysql, not java lol)

And the framework has integrated the OneSignal & Firebase push notifications service…

To this point all is working really great… but I wan’t to level up my project to a new step, and send user-specific push notifications (Ex. Someone post on your profile)

I know that I can take advantage of OneSignal Tags to add a tag for every OneSignal subscribed user with my website userid… but the problem is that I don´t know how to take that $_SESSION[“userid”] from my php website and use it on my Android Webview App to create the OneSignal tag for the current user…

In my Android files, I have a file called OnesignalMessagingService.kt with this information:

`package name...

import android.app.Application
import android.content.Context
import android.content.Intent
import android.util.Log
import com.onesignal.OSNotification
import com.onesignal.OSNotificationAction
import com.onesignal.OSNotificationOpenResult
import com.onesignal.OneSignal
import infix.imrankst1221.codecanyon.MainActivity

class OnesignalMessagingService: Application() {
val TAG = "---Onesignal"
lateinit var mContext: Context

override fun onCreate() {
super.onCreate()
mContext = this
OneSignal.startInit(this)
.setNotificationOpenedHandler(NotificationHandler())
.autoPromptLocation(true)
.inFocusDisplaying(OneSignal.OSInFocusDisplayOption.Notification)
.setNotificationReceivedHandler(NotificationReceivedHandler())
.init()

OneSignal.idsAvailable { userId, registrationId -> Log.d("", ""+userId) }
}


inner class NotificationHandler : OneSignal.NotificationOpenedHandler {
// This fires when a notification is opened by tapping on it.
override fun notificationOpened(result: OSNotificationOpenResult) {
val actionType = result.action.type
val data = result.notification.payload.additionalData
val customKey: String?

if (data != null) {
customKey = data.optString("url", null)
if (customKey != null) {
AppDataInstance.getINSTANCE(mContext)
AppDataInstance.notificationUrl = customKey
AppDataInstance.isOpenOutside = data.optBoolean("is_open_outside", false)
Log.i(TAG, "Link set with value: $customKey")
}
}

if (actionType == OSNotificationAction.ActionType.ActionTaken)
Log.i(TAG, "Button pressed with id: " + result.action.actionID)

val intent = Intent(applicationContext, MainActivity::class.java)
intent.flags = Intent.FLAG_ACTIVITY_REORDER_TO_FRONT or Intent.FLAG_ACTIVITY_NEW_TASK
startActivity(intent)
}
}

private inner class NotificationReceivedHandler : OneSignal.NotificationReceivedHandler {
override fun notificationReceived(notification: OSNotification) {
// receive a notification
}
}
}`

How I can add this code to create the tag for the current user:

`OneSignal.sendTag("userId", "1");`

And how to change userid “1” with my current $_SESSION[“userid”] from the php weview website

I don´t know if it is helpfull but I’ve created a json file with the current session id:

https://tribbr.me/api/json/get_sessionid.php (it only echo information if you are logged in into my website): (Ej. https://jmp.sh/fdMQtdG )

Thanks for your help, I’m really new in Android developing, but with a big desire to learn new stuff every day :)

Phone acting very odd.

I've had this phone all of I've week and it's possessed I believe. First of all the in different areas of the settings menu it says phone number UNKNOWN under about phone. I've got many odd services running eating my data up. Some of my settings have been changed and won't allow me to change them back. I've included some screenshots for any feedback y'all may can give. Also I'm running some sort of Qualcomm. Qti. Aurora or something and all I can find in Google is something about dual SIM card. Please help. I know this is vague but I'll answer anything I can.

Attachments

  • Screenshot_20191109-061314.png
    Screenshot_20191109-061314.png
    101.4 KB · Views: 230
  • Screenshot_20191109-061026.png
    Screenshot_20191109-061026.png
    91.1 KB · Views: 218
  • Screenshot_20191109-061652.png
    Screenshot_20191109-061652.png
    74.8 KB · Views: 218

Root Reboot

Hey, the phone I've been using have started to get a black screen and get glitches across the screen. Right now it's in a whole black mode where I can't see anything, it doesn't react if I hold any of the buttons and all I see is some glitches. And if it does turn on it will only be on for a few seconds then it will become black again. I wonder if it will help if I reset it or is it a matter of the hardware?
Over-time the charge socket have been getting damp a lot and if this may have been the effects and it's actually the hardware, may be possible? Thanks if answer.
so lets first rule out a nefarious app that might have been installed. i would put the phone in safe mode. it is usually a combo of power and volume (it will vary according to models and manufacturers). this prevents any 3rd party apps from running. if it is still happening then i would do a factory reset.

if that does not work then, then it is a hardware issue.

Help SD Card Apps Greyed Out, Can't Open

Try using the Play Store app to reinstall those now greyed-out apps. There's a good chance that the saved data for each of those apps still reside in their respective folders in the internal storage. (When you're 'moving' apps to an microSD card, it's still matter where not everything relative to the app gets moved over. It's actually a situation where parts of the app have to remain in the internal storage while other parts reside on the card.)
This same situation occurs if you've forgotten that you've moved some apps to your card and later remove the card. The apps in question need to be reinstalled to function again because parts of them are no longer accessible.
As to why you're having this problem after rebooting, how did you 'move' those apps? Using the Settings menu in your phone or using a third-party app you installed?

https://play.google.com/store/apps/details?id=com.mobond.mindicator&hl=en_US
https://play.google.com/store/apps/details?id=com.intsig.camscanner&hl=en_US
https://play.google.com/store/apps/details?id=com.mobisystems.office&hl=en_US
https://play.google.com/store/apps/details?id=com.thinkyeah.galleryvault&hl=en_US
Heyy.. that really worked. Thank you so much

Wifi Calling - Android Phone

I have problems sending & receiving calls on my cell phone from inside my home (Aluminum siding exterior). Things are fine outside and in other buildings. My carrier says that nothing can be done from their end.

Someone suggested that using ‘wifi calling’ (with my present phone #) on my home’s wireless network while indoors as a possible solution. Can this be used for this purpose? If so, how? I do not see the settings on my phone to enable it.

John

Sony Experia E5 F3313
Android 6.0
Hangouts dialer?

How can I create an App like Appblock or Forest?

I'm currently using Android Studio to create an App.
I want one of the features to block apps, after you activate this by clicking on a button.

So that the app moves in the background, after clicking the button and when you open for example Youtube, it pops up and says something like: "Deactivate this program first".

The basic idea is of course a Clicklistener on this button to start the program
But know I want to know, which commmand you have to use so that the app is permanently supervising, which app you are opening/ have openend, even though the app moved to the background.
Some kind of Clicklistener for this (in the example:Youtube) exact app.

I'm fairly new to App programming :)
Thanks in advance.

Example Apps
https://www.forestapp.cc/
https://www.appblock.app/

#1

Using Google Spread Sheet AS DataBase for Android application

Dears

I want to develop an android application while Using Google Spread Sheet AS DataBase, in this context i need help:
1- If anyone have working example for this in Android studio project, kindly gift me.
2- Secondly, i want to make attached google spreadsheet available offline, when user first time open app, app should download google spread to user mobile and user can use this on re-opening of app even if there is no internet connection. User also can sync sheet when he wants.

Second Impressions

I really don't like the power button below the volume rocker but I will adjust. Not much choice there. And I agree about the spen gestures. I played with them for a bit but found I didn't have much use for them and they could be more frustrating than useful other than the flick up and down to open and close the spen air options. That I do like. All in all though, I like the phone at least as much as I did my Note 8 which I loved.

Filter

Back
Top Bottom