Android show dialog like with GoSMS -


In the Gosms app, we want to see the newly received SMS messages in the phone desktop and I have this capability in this application. I'm trying to use simple and alerts_log in onStop () look like this:

  secure void onStop () {builder.setMessage ( "Test message") Kset Knabl qualified (true) KsetPositiveButton ( "OK", the new DialogInterface.OnClickListener () {public void Click (DialogInterface dialog, int id) {dialog.cancel () ;}}); AlertDialog Warning = Builder.Create (); Alert.show (); Super.onStop (); Logs. ("Onstop", ""); }  

But it could not work correctly. After that I am trying to show this dialogue through service. All the methods do not work for me correctly Please help me to do this

Screenshots: Enter image details here

You need to find out whether your app is background or foreground Is in or not

Approach:

  1. Add broadcast receiver to listen to the incoming message
  2. Check if your app is in the foreground or not
  3. If it is in the background, show the dialog box

code snippet:

Apply a custom application class which will apply the status of the application Changes

>
  The public class increases the myanalytic application {Public stable boolean actionability () {returning c Ividhi visibility; } Public static zero activity re () {activityVisible = true; } Public static zero activity halted () {activityVisible = false; } Private Stable Boolean activity view; }  

To change the application status, add onPause and onResume for each activity in the project:

  @ Override Protected Zero (Regenerate) {super.onResume (); MyApplication.activityResumed (); } @ Override Protected Zero at Pause () {Super. MyApplication.activityPaused (); }  

Add permission and register the receiver in the manifest:

  & lt; Usage-permission Android: name = "android.permission.RECEIVE_SMS" & gt; & Lt; Uses / Permissions & gt; & Lt; Usage-permission Android: name = "android.permission.READ_SMS" & gt; & Lt; / Usage-permission & gt; & Lt; Receiver Android: name = ". SMSBroadcastReceiver" & gt; & Lt; Intent-Filter & gt; & Lt; Action Android: name = "android.provider.Telephony.SMS_RECEIVED" /> & Lt; / Intent-Filter & gt; & Lt; / Receiver & gt; Public class SMSBroadcastReceiver extends broadcast receiver {@ but relevant context (reference model, meaning intended) override public void {/ code> on  

SMSBroadcastReceiver: < Pre> / TODO auto-generated method stub bundle bundle = intestine .getExtras (); SMS Message [] msgs = Null; String str = "no message received"; If (bundle! = Null) {object [] pdus = (object []) bundle.get ("puds"); Msgs = New SMS Message [pdus.length]; For (int i = 0; i


Comments

Popular posts from this blog

java - Can't add JTree to JPanel of a JInternalFrame -

javascript - data.match(var) not working it seems -

javascript - How can I pause a jQuery .each() loop, while waiting for user input? -