-
Content Count
36 -
Joined
-
Last visited
Everything posted by Minox
-
Hi everyone, i need to ask the permissions to read the notifications on the device, but i can't find the correct way to do it, in the project options i selected the "Bind notification listner service" permission. The code I use is this: uses ... Androidapi.JNI.GraphicsContentViewText, Androidapi.JNI.Provider, Androidapi.Helpers, Androidapi.JNI.JavaTypes, System.StrUtils ... procedure TFormTestPerm.Button1Click(Sender: TObject); //to show the permissions dialog VAR LIntent : JIntent; begin LIntent := TJIntent.Create; LIntent.setAction(TJSettings.JavaClass.ACTION_NOTIFICATION_LISTENER_SETTINGS); TAndroidHelper.Context.startActivity(LIntent); end; procedure TFormTestPerm.Button2Click(Sender: TObject); //to take the test VAR SecureS : JString; NomeAppS : String; begin NomeAppS := JStringToString(TAndroidHelper.Context.getPackageName); SecureS := TJSettings_Secure.JavaClass.getString(SharedActivityContext.getContentResolver, StringToJString('enabled_notification_listeners')); If AnsiContainsText(JStringToString(SecureS),NomeAppS) Then Label1.Text := 'SERVICE FOUND!' Else Label1.Text := 'NO SERVICE FOUND'+sLineBreak+'"'+NomeAppS+'"'; end; but my application does not appear in the list. I've found a few solutions on the net that I still can't get to work. Does anyone know the proper way to ask for this type of permission?
-
Ask permission to read device notifications on android 13
Minox replied to Minox's topic in Cross-platform
I managed to get the demo working, I didn't realize I have to add the ".jar" file in "Projects" too, thanks again -
Ask permission to read device notifications on android 13
Minox replied to Minox's topic in Cross-platform
ah yes sorry, I was laughing at the demo you indicated to me, it doesn't open, I can compile it but when it starts it closes immediately, the only way to start it is to remove the code in "onCreate". The device on which I test is a s10e with android 12, and RAD studio 11.3. -
Ask permission to read device notifications on android 13
Minox replied to Minox's topic in Cross-platform
Unfortunately I can't get the app to work, when opening it it either crashes or closes immediately. However it can help me to understand what the method is -
Ask permission to read device notifications on android 13
Minox replied to Minox's topic in Cross-platform
Thank you! now I study it -
try like this procedure TForm1.TrackBar1Change(Sender: TObject); begin ShowValue; //ScaledLayout1.Scale.X := TrackBar1.Value; //ScaledLayout1.Scale.Y := TrackBar1.Value; ScaledLayout1.BeginUpdate; ScaledLayout1.Width := ScaledLayout1.OriginalWidth * TrackBar1.Value; ScaledLayout1.Height := ScaledLayout1.OriginalHeight * TrackBar1.Value; ScaledLayout1.EndUpdate; //ScaledLayout1.RecalcAbsoluteNow; //ScaledLayout1.RecalcSize; end;
-
why do you resize the size too?
-
Ask permission to read device notifications on android 13
Minox replied to Minox's topic in Cross-platform
I have attached the code created so far, which once started it shows that my app does not appear in the list of those asking for permission. I found another site where they discuss this topic NotificationListenerService it looks like i have to declare a service before asking permissions, so now i will try to declare one, but i find it hard because java is too hard for me. TestPerm.zip -
Ask permission to read device notifications on android 13
Minox replied to Minox's topic in Cross-platform
From the latest versions of Android, to read the notifications the user must manually approve this choice, therefore when starting the app you have to open the notification authorization list and let him select it. To achieve this, as far as I understand, you need to set the "android.permission.BIND_NOTIFICATION_LISTENER_SERVICE" permission in the Manifest file (I do this in the project options), as described here: NotificationListenerService, and then at runtime open the permissions page to ask the user to activate them, using this entry: Settings Here a procedure in java: notificationlistenerservice I know my approach is wrong, but i don't understand where. For example, when I asked permission for brightness in other applications, I used the same approach, and it worked. -
To improve fluidity I would use a thread, so as to limit the pauses due to the execution of something else
-
This is because the actual size of the rectangle does not change. Try inserting the main rectangle in a Layout of the same size, and when you work with the TrackBar change the size of the Layout appropriately. Or resize the main rectangle directly, instead of acting on the "Scale" property