ईएमएम इंटिग्रेशन गाइड

इस गाइड से एंटरप्राइज़ मोबिलिटी मैनेजमेंट (ईएमएम) सेवा देने वाली कंपनियों को अपने कंसोल में, पहले से तैयार डिवाइस को इंटिग्रेट करने में मदद मिलती है. रजिस्ट्रेशन के बारे में ज़्यादा जानने के लिए, पढ़ना जारी रखें और अपने DPC (डिवाइस नीति कंट्रोलर) प्रावधान वाले डिवाइसों की मदद करने के लिए, सबसे सही तरीके वाली सलाह देखें. अगर आपके पास डीपीसी है, तो आपको डिवाइसों को सेट अप करने के सबसे सही तरीकों के बारे में जानकारी मिलेगी. साथ ही, डेवलपमेंट और टेस्टिंग में मदद के लिए सलाह भी मिलेगी.

आईटी एडमिन के लिए सुविधाएं

ग्राहक एपीआई का इस्तेमाल करके, आईटी एडमिन को सीधे आपके कंसोल से 'पहले से तैयार डिवाइस' सुविधा सेट अप करने में मदद मिलती है. यहां कुछ ऐसे काम दिए गए हैं जिन्हें आईटी एडमिन आपके कंसोल में पूरा कर सकता है:

  • मोबाइल की नीतियों के आधार पर, 'पहले से तैयार डिवाइस' सुविधा वाले कॉन्फ़िगरेशन बनाएं, उनमें बदलाव करें, और उन्हें मिटाएं.
  • डिफ़ॉल्ट कॉन्फ़िगरेशन सेट करें, ताकि DPC की मदद से संगठन के आने वाले समय में खरीदे जाने वाले डिवाइसों को सेट अप किया जा सके.
  • डिवाइसों पर अलग-अलग कॉन्फ़िगरेशन लागू करें या पहले से तैयार डिवाइसों को हटाएं.

पहले से तैयार डिवाइस के बारे में ज़्यादा जानने के लिए, खास जानकारी लेख पढ़ें.

ज़रूरी शर्तें

अपने ईएमएम कंसोल में पहले से तैयार डिवाइस को जोड़ने से पहले, पुष्टि करें कि आपका समाधान इन चीज़ों के साथ काम करता है:

  • आपके ईएमएम सलूशन के लिए ज़रूरी है कि वह कंपनी के मालिकाना हक वाले Android 8.0 और उसके बाद के वर्शन (Pixel 7.1 और उसके बाद के वर्शन) वाले डिवाइस को 'पूरी तरह से मैनेज की गई' मोड में सेट करे. कंपनी के मालिकाना हक वाले Android 10 या इसके बाद के वर्शन वाले डिवाइसों का प्रावधान, पूरी तरह से मैनेज या वर्क प्रोफ़ाइल के तौर पर किया जा सकता है.
  • 'पहले से तैयार डिवाइस' प्रोसेस अपने-आप डीपीसी को डाउनलोड और इंस्टॉल करता है. इसलिए, आपका डीपीसी Google Play पर उपलब्ध होना चाहिए. हमारे पास ऐसे DPC की सूची है जिन्हें आईटी एडमिन कस्टमर एपीआई या पोर्टल का इस्तेमाल करके कॉन्फ़िगर कर सकते हैं. अपने DPC को सूची में जोड़ने के लिए, ईएमएम सेवा देने वाली कंपनी के समुदाय की मदद से, प्रॉडक्ट में बदलाव करने का अनुरोध सबमिट करें.
  • ग्राहक एपीआई को कॉल करने के लिए, आपके ग्राहकों को 'पहले से तैयार डिवाइस' सुविधा वाले खाते की ज़रूरत होगी. पार्टनर रीसेलर, आईटी एडमिन के संगठन के लिए खाता तब सेट अप करता है, जब संगठन उस संगठन के डिवाइसों को खरीदता है.
  • 'पहले से तैयार डिवाइस' सुविधा को रजिस्टर करने के लिए ज़रूरी है कि डिवाइस Google मोबाइल सेवाओं (GMS) के साथ काम करता हो. साथ ही, Google Play services हर समय चालू होनी चाहिए, ताकि 'पहले से तैयार डिवाइस' सुविधा सही तरीके से काम करे.

एपीआई को कॉल करें

आपके कंसोल के उपयोगकर्ता (अपने Google खाते का इस्तेमाल करके) ग्राहक एपीआई के लिए आपके एपीआई अनुरोधों को अनुमति देते हैं. यह फ़्लो, अन्य ईएमएम एपीआई के लिए की जाने वाली अनुमति से अलग होता है. अपने ऐप्लिकेशन में ऐसा करने का तरीका जानने के लिए, अनुमति लेख पढ़ें.

सेवा की शर्तें मैनेज करना

आपके उपयोगकर्ताओं को एपीआई को कॉल करने से पहले, सेवा की नई शर्तें स्वीकार करनी होंगी. अगर एपीआई कॉल, एचटीटीपी 403 Forbidden स्टेटस कोड दिखाता है और रिस्पॉन्स के मुख्य हिस्से में TosError मौजूद होता है, तो 'पहले से तैयार डिवाइस' सुविधा वाले पोर्टल में साइन इन करके, उपयोगकर्ता से सेवा की शर्तें स्वीकार करने का अनुरोध करें. यहां दिए गए उदाहरण में, ऐसा करने का कोई एक तरीका बताया गया है:

Java

// Authorize this method call as a user that hasn't yet accepted the ToS.
final String googleApiFormatHttpHeader = "X-GOOG-API-FORMAT-VERSION";
final String googleApiFormatVersion = "2";
final String tosErrorType =
      "type.googleapis.com/google.android.device.provisioning.v1.TosError";

try {
  // Send an API request to list all the DPCs available including the HTTP header
  // X-GOOG-API-FORMAT-VERSION with the value 2. Import the  exception:
  // from googleapiclient.errors import HttpError
  AndroidProvisioningPartner.Customers.Dpcs.List request =
        service.customers().dpcs().list(customerAccount);
  request.getRequestHeaders().put(googleApiFormatHttpHeader, googleApiFormatVersion);
  CustomerListDpcsResponse response = request.execute();
  return response.getDpcs();

} catch (GoogleJsonResponseException e) {
  // Get the error details. In your app, check details exists first.
  ArrayList<Map> details = (ArrayList<Map>) e.getDetails().get("details");
  for (Map detail : details) {
    if (detail.get("@type").equals(tosErrorType)
          && (boolean) detail.get("latestTosAccepted") != true) {
      // Ask the user to accept the ToS. If they agree, open the portal in a browser.
      // ...
    }
  }
  return null;
}

.NET

// Authorize this method call as a user that hasn't yet accepted the ToS.
try
{
    var request = service.Customers.Dpcs.List(customerAccount);
    CustomerListDpcsResponse response = request.Execute();
    return response.Dpcs;
}
catch (GoogleApiException e)
{
    foreach (SingleError error in e.Error?.Errors)
    {
        if (error.Message.StartsWith("The user must agree the terms of service"))
        {
            // Ask the user to accept the ToS. If they agree, open the portal in a browser.
            // ...
        }
    }
}

Python

# Authorize this method call as a user that hasn't yet accepted the ToS.
tos_error_type = ('type.googleapis.com/'
                  'google.android.device.provisioning.v1.TosError')
portal_url = 'https://partner.android.com/zerotouch'

# Send an API request to list all the DPCs available including the HTTP
# header X-GOOG-API-FORMAT-VERSION with the value 2. Import the exception:
# from googleapiclient.errors import HttpError
try:
  request = service.customers().dpcs().list(parent=customer_account)
  request.headers['X-GOOG-API-FORMAT-VERSION'] = '2'
  response = request.execute()
  return response['dpcs']

except HttpError as err:
  # Parse the JSON content of the error. In your app, check ToS exists first.
  error = json.loads(err.content)
  tos_error = error['error']['details'][0]

  # Ask the user to accept the ToS (not shown here). If they agree, then open
  # the portal in a browser.
  if (tos_error['@type'] == tos_error_type
      and tos_error['latestTosAccepted'] is not True):
    if raw_input('Accept the ToS in the zero-touch portal? y|n ') == 'y':
      webbrowser.open(portal_url)

अगर आपका Google API क्लाइंट ज़्यादा जानकारी वाली गड़बड़ियों (Java, Python या एचटीटीपी अनुरोध) के साथ काम करता है, तो अपने अनुरोधों में 2 वैल्यू के साथ एचटीटीपी हेडर X-GOOG-API-FORMAT-VERSION शामिल करें. अगर आपका क्लाइंट ज़्यादा जानकारी वाली गड़बड़ियों (.NET और अन्य) के साथ काम नहीं करता, तो गड़बड़ी के मैसेज से मिलान करें.

आने वाले समय में सेवा की शर्तों को अपडेट करने पर, आपका ऐप्लिकेशन लोगों को नई सेवा की शर्तों को फिर से स्वीकार करने के लिए कहेगा.

आईटी एडमिन अपने संगठन के उपयोगकर्ताओं को मैनेज करने के लिए, 'पहले से तैयार डिवाइस' सुविधा वाले पोर्टल का इस्तेमाल करते हैं—आपका यह सुविधा ग्राहक एपीआई के ज़रिए नहीं दी जा सकती. आईटी एडमिन, पोर्टल का इस्तेमाल करके डिवाइसों और कॉन्फ़िगरेशन को भी मैनेज कर सकते हैं. अगर आपको अपने कंसोल या दस्तावेज़ में पोर्टल से लिंक करने की ज़रूरत है, तो इस यूआरएल का इस्तेमाल करें:

https://partner.android.com/zerotouch

आईटी एडमिन को यह सूचना दी जा सकती है कि उनसे उनके Google खाते से साइन इन करने के लिए कहा जाता है.

डिवाइस रजिस्टर करें

पहले से तैयार डिवाइस, डिवाइसों को रजिस्टर करने का एक तरीका है. यह एनएफ़सी रजिस्ट्रेशन या क्यूआर कोड रजिस्टर करने जैसा ही है. यह ज़रूरी है कि आपके कंसोल में मैनेज किए जा रहे डिवाइस काम करते हों और आपका DPC, पूरी तरह से मैनेज किए गए डिवाइस मोड में चल सके.

पहले से तैयार डिवाइस की सुविधा, Android 8.0 या इसके बाद के वर्शन वाले डिवाइसों पर उपलब्ध है. आईटी एडमिन को साथ काम करने वाले डिवाइस, किसी पार्टनर रीसेलर से खरीदने होंगे. आपका कंसोल यह ट्रैक कर सकता है कि customers.devices.list को कॉल करके, आईटी एडमिन के कौनसे डिवाइस 'पहले से तैयार डिवाइस' सुविधा में रजिस्टर करने के लिए उपलब्ध हैं.

यहां रजिस्ट्रेशन के काम करने का तरीका बताया गया है:

  1. पहले शुरू होने पर (या फ़ैक्ट्री रीसेट होने के बाद) डिवाइस, 'पहले से तैयार डिवाइस' पर Google सर्वर की मदद से जांच करता है कि 'पहले से तैयार डिवाइस' सुविधा चालू है या नहीं.
  2. अगर आईटी एडमिन ने डिवाइस के लिए कोई कॉन्फ़िगरेशन लागू किया है, तो 'पहले से तैयार डिवाइस' सुविधा, पूरी तरह से मैनेज किए जा रहे डिवाइस के Android सेटअप विज़र्ड पर काम करती है. साथ ही, स्क्रीन को अपने हिसाब से बनाने के लिए, कॉन्फ़िगरेशन का मेटाडेटा भी इस्तेमाल करती है.
  3. पहले से तैयार डिवाइस को डाउनलोड करके Google Play से आपका DPC इंस्टॉल करें.
  4. आपके DPC को ACTION_PROVISION_MANAGED_DEVICE इंटेंट मिल जाता है और वह डिवाइस को सेट अप कर देता है.

अगर इंटरनेट कनेक्शन न हो, तो जांच तब होती है, जब कोई इंटरनेट कनेक्शन उपलब्ध हो. पहले से तैयार डिवाइस की प्रोसेस के साथ डिवाइस को सेट अप करने के बारे में ज़्यादा जानने के लिए, नीचे दिया गया प्रावधान देखें.

डिफ़ॉल्ट कॉन्फ़िगरेशन

'पहले से तैयार डिवाइस' सुविधा को ज़्यादातर आईटी एडमिन को तब मदद मिलती है, जब वे डिफ़ॉल्ट कॉन्फ़िगरेशन सेट करते हैं. यह कॉन्फ़िगरेशन उनके संगठन के खरीदे गए किसी भी नए डिवाइस पर लागू होता है. अगर कोई कॉन्फ़िगरेशन सेट नहीं है, तो अपने कंसोल से डिफ़ॉल्ट कॉन्फ़िगरेशन सेट करने को प्रमोट करें. customers.configurations.isDefault की वैल्यू देखकर, यह पता लगाया जा सकता है कि किसी संगठन ने डिफ़ॉल्ट कॉन्फ़िगरेशन सेट किया है या नहीं.

नीचे दिए गए उदाहरण में बताया गया है कि किसी मौजूदा कॉन्फ़िगरेशन को डिफ़ॉल्ट कॉन्फ़िगरेशन कैसे बनाया जा सकता है:

Java

// Send minimal data with the request. Just the 2 required fields.
// targetConfiguration is an existing configuration that we want to make the default.
Configuration configuration = new Configuration();
configuration.setIsDefault(true);
configuration.setConfigurationId(targetConfiguration.getConfigurationId());

// Call the API, including the FieldMask to avoid setting other fields to null.
AndroidProvisioningPartner.Customers.Configurations.Patch request = service
      .customers()
      .configurations()
      .patch(targetConfiguration.getName(), configuration);
request.setUpdateMask("isDefault");
Configuration results = request.execute();

.NET

// Send minimal data with the request. Just the 2 required fields.
// targetConfiguration is an existing configuration that we want to make the default.
Configuration configuration = new Configuration
{
    IsDefault = true,
    ConfigurationId = targetConfiguration.ConfigurationId,
};

// Call the API, including the FieldMask to avoid setting other fields to null.
var request = service.Customers.Configurations.Patch(configuration,
                                                     targetConfiguration.Name);
request.UpdateMask = "IsDefault";
Configuration results = request.Execute();

Python

# Send minimal data with the request. Just the 2 required fields.
# target_configuration is an existing configuration we'll make the default.
configuration = {
    'isDefault': True,
    'configurationId': target_configuration['configurationId']}

# Call the API, including the FieldMask to avoid setting other fields to null.
response = service.customers().configurations().patch(
    name=target_configuration['name'],
    body=configuration, updateMask='isDefault').execute()

आपके DPC का रेफ़रंस दिया जा रहा है

अपने DPC की पहचान करने और कॉन्फ़िगरेशन में इसका इस्तेमाल करने के लिए, हमारा सुझाव है कि आप एपीआई संसाधन का नाम customers.dpcs.name इस्तेमाल करें. संसाधन के नाम में DPC के लिए एक खास और न बदलने वाला आइडेंटिफ़ायर होता है. इस्तेमाल किए जा सकने वाले सभी DPC की सूची पाने के लिए, customers.dpcs.list को कॉल करें. रिसॉर्स के नाम में ग्राहक आईडी भी शामिल होता है. इसलिए, Dpc से मिलता-जुलता इंस्टेंस ढूंढने के लिए, आखिरी पाथ कॉम्पोनेंट का इस्तेमाल करके सूची को फ़िल्टर करें. नीचे दिए गए उदाहरण में, अपने DPC को मैच करने और उसे बाद में कॉन्फ़िगरेशन में इस्तेमाल करने के लिए बनाए रखने का तरीका बताया गया है:

Java

// Return a customer Dpc instance for the specified DPC ID.
String myDpcIdentifier = "AH6Gbe4aiS459wlz58L30cqbbXbUa_JR9...xMSWCiYiuHRWeBbu86Yjq";
final int dpcIdIndex = 3;
final String dpcComponentSeparator = "/";
// ...
for (Dpc dpcApp : dpcs) {
    // Because the DPC name is in the format customers/{CUST_ID}/dpcs/{DPC_ID}, check the
    // fourth component matches the DPC ID.
    String dpcId = dpcApp.getName().split(dpcComponentSeparator)[dpcIdIndex];
    if (dpcId.equals(myDpcIdentifier)) {
        System.out.format("My DPC is: %s\n", dpcApp.getDpcName());
        return dpcApp;
    }
}
// Handle the case when the DPC isn't found...

.NET

// Return a customer Dpc instance for the specified DPC ID.
var myDpcIdentifer = "AH6Gbe4aiS459wlz58L30cqbbXbUa_JR9...fE9WdHcxMSWCiYiuHRWeBbu86Yjq";
const int dpcIdIndex = 3;
const String dpcComponentSeparator = "/";
// ...
foreach (Dpc dpcApp in dpcs)
{
    // Because the DPC name is in the format customers/{CUST_ID}/dpcs/{DPC_ID}, check the
    // fourth component matches the DPC ID.
    String dpcId = dpcApp.Name.Split(dpcComponentSeparator)[dpcIdIndex];
    if (dpcId.Equals(myDpcIdentifer))
    {
        Console.WriteLine("Matched DPC is: {0}", dpcApp.DpcName);
        return dpcApp;
    }
}
// Handle the case when the DPC isn't found...

Python

# Return a customer Dpc instance for the specified DPC ID.
my_dpc_id = 'AH6Gbe4aiS459wlz58L30cqb...fE9WdHcxMSWCiYiuHRWeBbu86Yjq'
# ...
for dpc_app in dpcs:
  # Because the DPC name is in the format customers/{CUST_ID}/dpcs/{DPC_ID},
  # check the fourth component matches the DPC ID.
  dpc_id = dpc_app['name'].split('/')[3]
  if dpc_id == my_dpc_id:
    return dpc_app

# Handle the case when the DPC isn't found...

अगर आपको अपने कंसोल के यूज़र इंटरफ़ेस में किसी DPC का नाम दिखाना है, तो customers.dpcs.dpcName से मिली वैल्यू दिखाएं.

प्रावधान

डिवाइस प्रावधान करने के लिए बेहतरीन उपयोगकर्ता अनुभव उपलब्ध कराएं. डिवाइस को सेट अप करने के लिए, उपयोगकर्ता नाम और पासवर्ड ही होना चाहिए. याद रखें कि रीसेलर, रिमोट उपयोगकर्ताओं को सीधे डिवाइस भेज सकते हैं. customers.configuration.dpcExtras में, ईएमएम सर्वर या संगठन की इकाई जैसी अन्य सभी सेटिंग शामिल करें.

नीचे दिया गया JSON स्निपेट, कॉन्फ़िगरेशन के एक उदाहरण का हिस्सा है:

{
  "android.app.extra.PROVISIONING_LOCALE": "en_GB",
  "android.app.extra.PROVISIONING_TIME_ZONE": "Europe/London",
  "android.app.extra.PROVISIONING_LEAVE_ALL_SYSTEM_APPS_ENABLED": true,
  "android.app.extra.PROVISIONING_ADMIN_EXTRAS_BUNDLE": {
    "workflow_type": 3,
    "default_password_quality": 327680,
    "default_min_password_length": 6,
    "company_name": "XYZ Corp",
    "organizational_unit": "sales-uk",
    "management_server": "emm.example.com",
    "detail_tos_url": "https://www.example.com/policies/terms/",
    "allowed_user_domains": "[\"example.com\", \"example.org\", \"example.net\"]"
    }
}

पहले से तैयार डिवाइस को Android इंटेंट का इस्तेमाल करके इंस्टॉल और लॉन्च किया जाता है. सिस्टम आपके DPC को android.app.extra.PROVISIONING_ADMIN_EXTRAS_BUNDLE JSON प्रॉपर्टी में मौजूद वैल्यू, इंटेंट में अतिरिक्त के तौर पर भेजता है. आपका DPC इन्हीं कुंजियों का इस्तेमाल करके, PersistableBundle से प्रावधान सेटिंग पढ़ सकता है.

सुझाव—अपने DPC को सेट अप करने के लिए, इन अतिरिक्त इंटेंट का इस्तेमाल करें:

इसका सुझाव नहीं दिया जाता—हालांकि, नीचे दी गई ऐसी अन्य चीज़ों को शामिल न करें जिनका इस्तेमाल आप रजिस्टर करने के दूसरे तरीकों में कर सकते हैं:

अपने DPC में इन सेटिंग को निकालने और इनका इस्तेमाल करने के बारे में जानने के लिए, ग्राहक के डिवाइसों को सेट अप करने का तरीका लेख पढ़ें.

डेवलपमेंट और टेस्टिंग

अपने कंसोल की'पहले से तैयार डिवाइस' सुविधा को डेवलप करने और टेस्ट करने के लिए, आपको इन चीज़ों की ज़रूरत होगी:

  • इस सुविधा के साथ काम करने वाला डिवाइस
  • 'पहले से तैयार डिवाइस' सुविधा वाला ग्राहक खाता

पहले से तैयार डिवाइस की सुविधा वाले डिवाइसों, जैसे कि Google Pixel को डेवलप और टेस्ट करें. आपको किसी रीसेलर पार्टनर से डेवलपमेंट डिवाइस खरीदने की ज़रूरत नहीं है.

टेस्ट ग्राहक खाता पाने और 'पहले से तैयार डिवाइस' सुविधा वाले पोर्टल का ऐक्सेस पाने के लिए, हमसे संपर्क करें. हमें अपने कॉर्पोरेट ईमेल पते से ईमेल भेजें, जो कि Google खाते से जुड़ा हो. हमें एक या दो डिवाइस का मैन्युफ़ैक्चरर और IMEI नंबर बताएं. इसके बाद, हम उन्हें आपके डेवलपमेंट खाते में जोड़ देंगे.

याद रखें कि 'पहले से तैयार डिवाइस' सुविधा को अपने-आप डाउनलोड और इंस्टॉल करने की अनुमति होती है. इसलिए, प्रॉविज़निंग की जांच करने से पहले आपका डीपीसी Google Play पर उपलब्ध होना चाहिए. अपने DPC के डेवलपमेंट वर्शन से जांच नहीं की जा सकती.

आईटी एडमिन के लिए सहायता

अगर आपको अपने कंसोल के इंटरफ़ेस या दस्तावेज़ में आईटी एडमिन की मदद करनी है, तो आईटी एडमिन के लिए, 'पहले से तैयार डिवाइस' सुविधा को देखें. अपने कंसोल के उपयोगकर्ताओं को सहायता केंद्र के उस लेख पर भी भेजा जा सकता है.

इसके बारे में और पढ़ें

अपने कंसोल में, पहले से तैयार डिवाइस को इंटिग्रेट करने के लिए, इन दस्तावेज़ों को पढ़ें: