public MIDIAddressBookEntry(Bundle rinfo) { address = rinfo.getString(RINFO_ADDR, ""); port = rinfo.getInt(RINFO_PORT); name = rinfo.getString(RINFO_NAME, ""); reconnect = rinfo.getBoolean(RINFO_RECON, false); }
public override void onCreate(Bundle savedInstanceState) { base.onCreate(savedInstanceState); if (savedInstanceState != null) { mDeviceId = savedInstanceState.getString("deviceId"); mSelectedType = savedInstanceState.getInt("selectedType"); } }
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle state) { if ((state != null) && state.containsKey(BUNDLE_POSITION) && state.containsKey(BUNDLE_BOOK)) { mPosition = state.getInt(BUNDLE_POSITION); mBook = (Book) state.getSerializable(BUNDLE_BOOK); mEpubFileName = state.getString(BUNDLE_EPUB_FILE_NAME); mIsSmilAvailable = state.getBoolean(BUNDLE_IS_SMIL_AVAILABLE); } return super.onCreateView(inflater, container, state); }
/// <summary> /// Get drawable resource identifier from application meta-data. </summary> /// <param name="appMetaData"> application meta-data. </param> /// <param name="metaName"> meta-data key corresponding to the drawable resource name. </param> /// <returns> drawable resource identifier or 0 if not found. </returns> private int getIcon(Bundle appMetaData, string metaName) { /* Get drawable resource identifier from its name */ string iconName = appMetaData.getString(metaName); if (iconName != null) { return(EngagementResourcesUtils.getDrawableId(mContext, iconName)); } return(0); }
// This onReceive will be call when a OneSignal Background Data Notification is received(before clicking) by the device. // You can read the additionalData and do anything you need here with it. // You may consider adding a wake lock here if you need to make sure the devices doesn't go to sleep while processing. // The following must also be in your AndroidManifest.xml for this to fire: /* * <receiver * android:name="com.onesignal.example.BackgroundDataBroadcastReceiver" * android:exported="false"> * <intent-filter> * <action android:name="com.onesignal.BackgroundBroadcast.RECEIVE" /> * </intent-filter> * </receiver> * * Make sure to keep android:exported="false" so other apps can't call can this. */ public override void onReceive(Context context, Intent intent) { Bundle dataBundle = intent.getBundleExtra("data"); try { Log.i("OneSignalExample", "Notification content: " + dataBundle.getString("alert")); Log.i("OneSignalExample", "Notification title: " + dataBundle.getString("title")); Log.i("OneSignalExample", "Is Your App Active: " + dataBundle.getBoolean("isActive")); JSONObject customJSON = new JSONObject(dataBundle.getString("custom")); if (customJSON.has("a")) { Log.i("OneSignalExample", "additionalData: " + customJSON.getJSONObject("a").ToString()); } } catch (Exception t) { Console.WriteLine(t.ToString()); Console.Write(t.StackTrace); } }
protected override void OnNavigatedTo(NavigationEventArgs e) { base.OnNavigatedTo(e); if (e.Parameter is Bundle) { data = (Bundle)e.Parameter; } else { throw new InvalidBundleException("Invalid bundle passed"); } txt_RecievedData.Text = data.getString("SENT_DATA"); }
/// <summary> /// Constructs <seealso cref="MusicPlayerState"/> from bundle. /// </summary> /// <param name="savedState"> the bundle containing the saved mState </param> internal MusicPlayerState(Bundle savedState) { mMediaUri = Uri.parse(savedState.getString(MEDIA_URI)); mAlbumArtUri = Uri.parse(savedState.getString(COVER_URI)); mTitle = savedState.getString(TITLE); mArtist = savedState.getString(ARTIST); mMimeType = savedState.getString(MIMETYPE); mPlayback = Enum.Parse(typeof(PlayerController.PlayerState), savedState.getString(PLAYER_STATE)); mPosition = savedState.getInt(POSITION); mDuration = savedState.getInt(DURATION); mMute = savedState.getInt(MUTE) == 1; mDeviceId = savedState.getString(DEVICE_ID); }
/// <summary> /// Constructs <seealso cref="VideoPlayerState"/> from bundle. /// </summary> /// <param name="savedState"> the bundle containing the saved mState </param> internal VideoPlayerState(Bundle savedState) { mMediaUri = Uri.parse(savedState.getString(MEDIA_URI)); mSubtitlesUri = Uri.parse(savedState.getString(SUBTITLES_URI)); mTitle = savedState.getString(TITLE); mMimeType = savedState.getString(MIME_TYPE); mPlayback = Enum.Parse(typeof(PlayerController.PlayerState), savedState.getString(PLAYER_STATE)); mPosition = savedState.getInt(POSITION); mDuration = savedState.getInt(DURATION); mMute = savedState.getInt(MUTE) == 1; mDeviceId = savedState.getString(DEVICE_ID); }
public static bool isHybridApp(Activity act) { var v = false; try { ApplicationInfo appInfo = act.getPackageManager().getApplicationInfo(act.getPackageName(), PackageManager.GET_META_DATA); Bundle bundle = appInfo.metaData; string applicationMode = bundle.getString("com.samsung.android.vr.application.mode"); v = (applicationMode == ("dual")); } catch { Log.e(TAG, "Failed to load meta-data"); } return(v); }
protected override void OnNavigatedTo(NavigationEventArgs e) { base.OnNavigatedTo(e); if (e.Parameter == null || !(e.Parameter is Bundle)) { throw new InvalidBundleException("Found Invalid Bundle"); } Bundle b = (Bundle)e.Parameter; if (!b.Identifier.Equals("MainMenuPage")) { throw new InvalidBundleException("Found Invalid Bundle"); } currentUser = b.getString("USERNAME"); if (string.IsNullOrEmpty(currentUser)) { throw new ArgumentException("Invalid User logged in"); } }
/// <summary> /// Init the agent. </summary> /// <param name="context"> application context. </param> private EngagementAgent(Context context) { if (!InstanceFieldsInitialized) { InitializeInstanceFields(); InstanceFieldsInitialized = true; } /* Store application context, we'll use this to bind */ mContext = context; /* Create main thread handler */ mHandler = new Handler(Looper.MainLooper); /* Retrieve configuration */ Bundle config = EngagementUtils.getMetaData(context); mReportCrash = config.getBoolean("engagement:reportCrash", true); string settingsFile = config.getString("engagement:agent:settings:name"); int settingsMode = config.getInt("engagement:agent:settings:mode", 0); if (TextUtils.isEmpty(settingsFile)) { settingsFile = "engagement.agent"; } /* Watch preferences */ mSettings = context.getSharedPreferences(settingsFile, settingsMode); mSettingsListener = new OnSharedPreferenceChangeListenerAnonymousInnerClassHelper(this); mSettings.registerOnSharedPreferenceChangeListener(mSettingsListener); /* Install Engagement crash handler if enabled */ if (mReportCrash) { Thread.DefaultUncaughtExceptionHandler = mEngagementCrashHandler; } /* Broadcast intent for Engagement modules */ Intent agentCreatedIntent = new Intent(INTENT_ACTION_AGENT_CREATED); agentCreatedIntent.Package = context.PackageName; context.sendBroadcast(agentCreatedIntent); }
protected override async void OnNavigatedTo(NavigationEventArgs e) { base.OnNavigatedTo(e); base.OnNavigatedTo(e); if (e.Parameter == null || !(e.Parameter is Bundle)) { throw new InvalidBundleException("Found Invalid Bundle"); } Bundle b = (Bundle)e.Parameter; if (!b.Identifier.Equals("MainMenuPage")) { throw new InvalidBundleException("Found Invalid Bundle Origin"); } currentUser = b.getString("USERNAME"); if (string.IsNullOrEmpty(currentUser)) { throw new ArgumentException("Invalid User logged in"); } if (!await CreateViewModel()) { throw new InvalidDataException("Could not load records"); } }
/// <summary> /// Get drawable resource identifier from application meta-data. </summary> /// <param name="appMetaData"> application meta-data. </param> /// <param name="metaName"> meta-data key corresponding to the drawable resource name. </param> /// <returns> drawable resource identifier or 0 if not found. </returns> private int getIcon(Bundle appMetaData, string metaName) { /* Get drawable resource identifier from its name */ string iconName = appMetaData.getString(metaName); if (iconName != null) { return EngagementResourcesUtils.getDrawableId(mContext, iconName); } return 0; }
protected internal override void onCreate(Bundle savedInstanceState) { base.onCreate(savedInstanceState); ContentView = R.layout.activity_office_mover; // Initialize Firebase mFirebaseRef = new Firebase(FIREBASE); // Process authentication Bundle extras = Intent.Extras; string authToken; if (extras != null) { authToken = extras.getString(LoginActivity.AUTH_TOKEN_EXTRA); } else { Log.w(TAG, "Users must be authenticated to do this activity. Redirecting to login activity."); Intent loginIntent = new Intent(ApplicationContext, typeof(LoginActivity)); loginIntent.Flags = Intent.FLAG_ACTIVITY_CLEAR_TOP; startActivity(loginIntent); finish(); return; } mFirebaseRef.authWithOAuthToken("google", authToken, new AuthResultHandlerAnonymousInnerClassHelper(this)); // Initialize the view stuff mOfficeLayout = new OfficeLayout(); mOfficeCanvasView = (OfficeCanvasView)findViewById(R.id.office_canvas); mOfficeCanvasView.OfficeLayout = mOfficeLayout; mOfficeFloorView = (FrameLayout)findViewById(R.id.office_floor); // Listen for floor changes mFirebaseRef.child("background").addValueEventListener(new ValueEventListenerAnonymousInnerClassHelper(this)); // Listen for furniture changes mFirebaseRef.child("furniture").addChildEventListener(new ChildEventListenerAnonymousInnerClassHelper(this)); // Handles menu changes that happen when an office thing is selected or de-selected mOfficeCanvasView.ThingFocusChangeListener = new SelectedThingChangeListenerAnonymousInnerClassHelper(this); // Triggers whenever an office thing changes on the screen. This binds the // user interface to the scheduler that throttles updates to Firebase mOfficeCanvasView.ThingChangedListener = new ThingChangeListenerAnonymousInnerClassHelper(this); // A scheduled executor that throttles updates to Firebase to about 40ms each. // This prevents the high frequency change events from swamping Firebase. ScheduledExecutorService firebaseUpdateScheduler = Executors.newScheduledThreadPool(1); firebaseUpdateScheduler.scheduleAtFixedRate(() => { if (mStuffToUpdate != null && mStuffToUpdate.Count > 0) { foreach (OfficeThing officeThing in mStuffToUpdate.Values) { updateOfficeThing(officeThing.Key, officeThing); mStuffToUpdate.Remove(officeThing.Key); } } }, UPDATE_THROTTLE_DELAY, UPDATE_THROTTLE_DELAY, TimeUnit.MILLISECONDS); }
private void addToOutboundQueue(byte[] data, Bundle rinfo) { try { outboundQueue.add(new DatagramPacket(data, data.length, InetAddress.getByName(rinfo.getString(com.disappointedpig.midi.MIDIConstants.RINFO_ADDR)), rinfo.getInt(com.disappointedpig.midi.MIDIConstants.RINFO_PORT))); selector.wakeup(); } catch (UnknownHostException e) { e.printStackTrace(); } }