FORUMS PROFESSIONNELS
WINDEV
,
WEBDEV
et
WINDEV Mobile
Accueil
|
Messages récents
|
Connexion
|
Déconnexion
|
Français
Accueil
→
WINDEV Mobile 2024
→
Android and BroadcastReceiver revisited
Android and BroadcastReceiver revisited
Débuté par Meidell, 27 mar. 2018 09:59 - Aucune réponse
Connectez-vous…
Meidell
#1
Membre enregistré
15 messages
Posté le 27 mars 2018 - 09:59
Hi, the java code below should show a toast when somebody calls on the phone and is integrated as a method in windev mobile 22 and compiles fine. However when the app starts on the phone it throws the following error message "permission denial: not allowed to send broadcast android.intent.action.PHONE_STATE from...)
I have the READ_PHONE_STATE, WRITE_SECURE_SETTINGS and the WRTE_SETTINGS permisson ticked when you generate the code.
Quite frustrating. Any suggestions?
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.Toast;
import android.net.Uri;
import java.io.File;
import android.graphics.Color;
import android.widget.TextView;
import android.widget.LinearLayout;
import android.view.ViewGroup.LayoutParams;
import android.graphics.Color;
public static void CallService() {
Context context = getContexteApplication();
BroadcastReceiver myBroadcastReceiver = new BroadcastReceiver() {
public void onReceive(Context context, Intent intent) {
Toast.makeText (context , "Received broadcast", Toast.LENGTH_LONG).show();
String state = intent.getStringExtra(TelephonyManager.EXTRA_STATE);
if(state.equals(TelephonyManager.EXTRA_STATE_RINGING)){
Toast.makeText (context , "Ring ring", Toast.LENGTH_LONG).show();
}
}
};
Toast.makeText (context , "Start", Toast.LENGTH_LONG).show();
//2nd try
Intent intent = new Intent(TelephonyManager.ACTION_PHONE_STATE_CHANGED);
//Intent intent = new Intent("android.intent.action.PHONE_STATE");
getActiviteEnCours().sendBroadcast(intent);
}
--
Erik
Signaler
0
0
→ Revenir à WINDEV Mobile 2024
WINDEV 2024
WEBDEV 2024
WINDEV Mobile 2024
WINDEV (précédentes versions)
Français
English
Español
Portuguesa
Fermer cette fenêtre
Type de recherche
Uniquement les sujets
Tous les messages
Période de recherche
Date indifférente
Moins d'une heure
Moins de 24 heures
Moins d'une semaine
Moins d'un mois
Moins d'un an
Annuler
Aperçu de votre message
Ajouter une image
Importer une image depuis une URL
Envoyer une image depuis un fichier de votre disque
Déposez ici un fichier ou cliquez sur "Parcourir..."
ou
Annuler
0%
WLangage
SQL
XML, HTML
JAVA, Javascript
Texte