|
| 1 | +/* |
| 2 | + * Copyright (c) 2019 Livio, Inc. |
| 3 | + * All rights reserved. |
| 4 | + * |
| 5 | + * Redistribution and use in source and binary forms, with or without |
| 6 | + * modification, are permitted provided that the following conditions are met: |
| 7 | + * |
| 8 | + * Redistributions of source code must retain the above copyright notice, this |
| 9 | + * list of conditions and the following disclaimer. |
| 10 | + * |
| 11 | + * Redistributions in binary form must reproduce the above copyright notice, |
| 12 | + * this list of conditions and the following |
| 13 | + * disclaimer in the documentation and/or other materials provided with the |
| 14 | + * distribution. |
| 15 | + * |
| 16 | + * Neither the name of the Livio Inc. nor the names of its contributors |
| 17 | + * may be used to endorse or promote products derived from this software |
| 18 | + * without specific prior written permission. |
| 19 | + * |
| 20 | + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
| 21 | + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
| 22 | + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
| 23 | + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE |
| 24 | + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
| 25 | + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
| 26 | + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
| 27 | + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
| 28 | + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
| 29 | + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
| 30 | + * POSSIBILITY OF SUCH DAMAGE. |
| 31 | + */ |
| 32 | +package com.smartdevicelink.proxy.rpc; |
| 33 | + |
| 34 | +import android.support.annotation.NonNull; |
| 35 | + |
| 36 | +import com.smartdevicelink.proxy.RPCStruct; |
| 37 | + |
| 38 | +import java.util.Hashtable; |
| 39 | + |
| 40 | +public class AppInfo extends RPCStruct { |
| 41 | + |
| 42 | + public static final String KEY_APP_DISPLAY_NAME = "appDisplayName"; |
| 43 | + public static final String KEY_APP_BUNDLE_ID = "appBundleID"; |
| 44 | + public static final String KEY_APP_VERSION = "appVersion"; |
| 45 | + public static final String KEY_APP_ICON = "appIcon"; |
| 46 | + |
| 47 | + /** |
| 48 | + * Constructs a new AppInfo object |
| 49 | + */ |
| 50 | + public AppInfo() { } |
| 51 | + |
| 52 | + /** |
| 53 | + * Constructs a new AppInfo object indicated by the Hashtable parameter |
| 54 | + * @param hash The Hashtable to use |
| 55 | + */ |
| 56 | + public AppInfo(Hashtable<String, Object> hash) { |
| 57 | + super(hash); |
| 58 | + } |
| 59 | + |
| 60 | + /** |
| 61 | + * Constructs a new AppInfo object |
| 62 | + * @param appDisplayName - name displayed for the mobile application on the mobile device |
| 63 | + * @param appBundleID - package name of the application. |
| 64 | + * @param appVersion - build version number of this particular mobile app. |
| 65 | + */ |
| 66 | + public AppInfo(@NonNull String appDisplayName, String appBundleID, String appVersion){ |
| 67 | + this(); |
| 68 | + setAppDisplayName(appDisplayName); |
| 69 | + setAppBundleID(appBundleID); |
| 70 | + setAppVersion(appVersion); |
| 71 | + } |
| 72 | + |
| 73 | + /** Sets the name displayed for the mobile application on the mobile device (can differ from the app name set in the initial RAI request). |
| 74 | + * @param appDisplayName - name displayed for the mobile application on the mobile device. |
| 75 | + */ |
| 76 | + public void setAppDisplayName(@NonNull String appDisplayName) { |
| 77 | + setValue(KEY_APP_DISPLAY_NAME, appDisplayName); |
| 78 | + } |
| 79 | + |
| 80 | + /** Gets the name displayed for the mobile application on the mobile device (can differ from the app name set in the initial RAI request). |
| 81 | + * @return appDisplayName - name displayed for the mobile application on the mobile device. |
| 82 | + */ |
| 83 | + public String getAppDisplayName() { |
| 84 | + return getString(KEY_APP_DISPLAY_NAME); |
| 85 | + } |
| 86 | + |
| 87 | + /** Sets package name of the Android application. This supports App Launch strategies for each platform. |
| 88 | + * @param appBundleID - package name of the application |
| 89 | + */ |
| 90 | + public void setAppBundleID(@NonNull String appBundleID) { |
| 91 | + setValue(KEY_APP_BUNDLE_ID, appBundleID); |
| 92 | + } |
| 93 | + |
| 94 | + /** Gets package name of the Android application. This supports App Launch strategies for each platform. |
| 95 | + * @return appBundleID - package name of the application. |
| 96 | + */ |
| 97 | + public String getAppBundleID() { |
| 98 | + return getString(KEY_APP_BUNDLE_ID); |
| 99 | + } |
| 100 | + |
| 101 | + /** Sets build version number of this particular mobile app. |
| 102 | + * @param appVersion - build version number of this particular mobile app. |
| 103 | + */ |
| 104 | + public void setAppVersion(@NonNull String appVersion) { |
| 105 | + setValue(KEY_APP_VERSION, appVersion); |
| 106 | + } |
| 107 | + |
| 108 | + /** Gets build version number of this particular mobile app. |
| 109 | + * @return appVersion - build version number of this particular mobile app. |
| 110 | + */ |
| 111 | + public String getAppVersion() { |
| 112 | + return getString(KEY_APP_VERSION); |
| 113 | + } |
| 114 | + |
| 115 | + /** Sets file reference to the icon utilized by this app (simplifies the process of setting an app icon during app registration). |
| 116 | + * @param appIcon - file reference to the icon utilized by this app |
| 117 | + */ |
| 118 | + public void setAppIcon(String appIcon) { |
| 119 | + setValue(KEY_APP_ICON, appIcon); |
| 120 | + } |
| 121 | + |
| 122 | + /** Gets build version number of this particular mobile app. |
| 123 | + * @return appIcon - build version number of this particular mobile app. |
| 124 | + */ |
| 125 | + public String getAppIcon() { |
| 126 | + return getString(KEY_APP_ICON); |
| 127 | + } |
| 128 | +} |
0 commit comments