Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
//License from project: Apache License 

import android.content.Context;
import android.content.Intent;

public class Main {
    /**
     * Broadcast data as a message
     *
     * @param context
     *     the context
     * @param data
     *     the data
     * @param action
     *     the action
     * @param custompermission
     *     the custompermission
     */
    public static void broadcastData(Context context, String data, String action, String custompermission) {
        Intent i = new Intent();
        i.putExtra("data", data);
        i.setAction(action); // action ~ "com.example.android.action"
        context.sendBroadcast(i, custompermission); // custompermisson ~ "com.example.permission.MY_PERMISSION"
    }
}