Aller au contenu
View in the app

A better way to browse. Learn more.

Forum de Frandroid

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

autorisations d'écriture et exécution ?

Featured Replies

Posté(e)

Bonjour à tous,

je fais du développement sur android et je me posais une question.

Mon programme installé écrit dans son propre dossier, et les datas se mettent là :

/data/data/fr.societe.nomprog/files

 

Mais mon problème est que les droits du fichier sont juste lecture/écriture et pas exécution !

Et comme je crée un fichier apk, ça ne marche pas terrible ...

 

Est-ce que les droits sont mis en fonction de l'endroit où il est copié ?

 

Téléphone branché en USB, si je copie à la main l'apk dans Download, j'arrive à l’exécuter, par contre mon prog n'a pas le droit d'écrire dans Download à la racine du tel (en réalité /data/media/0/Download à priori).

 

Où ais-je le droit d'écrire un apk qui pourrait s'exécuter ?  :mad:

 

Merci


Bon j'ai eu la réponse

Ici ça fonctionne à merveille :

/mnt/sdcard/Android/data/fr.societe.nomprog/files

Posté(e)

/data/data/fr.societe.nomprog/app_bin :

 

try {

File file = new File(context.getDir("bin", 0), "nom_fichier_installer");

            copyRawFile(ctx, R.raw.nom_fichier_a_intaller, file, "755");
} catch (bla bla bla
 
 
private static void copyRawFile(Context context, int resid, File file,
                                    String mode) throws IOException, InterruptedException {
        final String abspath = file.getAbsolutePath();
        final FileOutputStream out = new FileOutputStream(file);
        final InputStream is = context.getResources().openRawResource(resid);
        byte buf[] = new byte[1024];
        int len;
        while ((len = is.read(buf)) > 0) {
            out.write(buf, 0, len);
        }
        out.close();
        is.close();
        Runtime.getRuntime().exec("chmod " + mode + " " + abspath).waitFor();
    }

Modifié par Old geek

Posté(e)
  • Auteur

lol

oui je développe, mais pas dans ce language là !   :P

Archivé

Ce sujet est désormais archivé et ne peut plus recevoir de nouvelles réponses.

Account

Navigation

Rechercher

Rechercher

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.